<%@ page import="entity.User" %><%--
  Created by IntelliJ IDEA.
  User: Teacher
  Date: 2025/9/9
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<%
    User user = (User) session.getAttribute("user");
    // 如果用户没找到,则说明尚未登录
    if(user == null){
%>

<a href="">注册</a>
<a href="<%=request.getContextPath()%>/jsp/login2.jsp">登录</a>
<%
    } else{
%>
欢迎您:<%=user.getUsername()%>
<a href="<%=request.getContextPath()%>/logout.code">注销</a>
<%
    }
%>
</body>
</html>
